
import install from './install'  
import Store from './store'

const mapState = arrList =>{
    let obj ={};
    for (let i = 0; i < arrList.length; i++) {
      const stateName = arrList[i];
      obj[stateName] = function () {
        return  this.$store.state[stateName]
      }
    }
    return obj ;
  }
    const mapGetters = arrList =>{
    let obj ={};
    for (let i = 0; i < arrList.length; i++) {
      const gettersName = arrList[i];
      obj[gettersName] = function () {
        return  this.$store.getters[gettersName]
      }
    }
    return obj ;
  }
  const mapActions = actionsList =>{
      let obj = {};
    for (let i = 0; i < actionsList.length; i++) {
        let type = actionsList[i]
        obj[type] = function(payload){
            this.$store.dispatch(type,payload);
        }
    }
    return obj
  }
  const mapMutations = mutationList =>{
      let obj = {};
    for (let i = 0; i < mutationList.length; i++) {
        let type = mutationList[i]
        obj[type] = function(payload){
            this.$store.commit(type,payload);
        }
    }
    return obj
  }


export default {
    install,
    Store,
    mapState,
    mapGetters,
    mapActions,
    mapMutations
}